package com.lightsaber.trade.cloth.entity.param;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Embeddable;

/**
 * RoleFuncId.
 */
@Embeddable
public class ParmId implements Serializable {

    private static final long serialVersionUID = 861716126340546086L;

    @Column(name = "SEGMENT", nullable = true, length = 20)
    private String segment;

    @Column(name = "ACAD_YEAR", nullable = true)
    private String acadYear;

    @Column(name = "SEMESTER", nullable = true, length = 3)
    private String semester;

    @Column(name = "CODE", nullable = true, length = 10)
    private String code;

    public ParmId() {
    }

    public String getSegment() {
        return segment;
    }

    public void setSegment(final String segment) {
        this.segment = segment;
    }

    public String getAcadYear() {
        return acadYear;
    }

    public void setAcadYear(final String acadYear) {
        this.acadYear = acadYear;
    }

    public String getSemester() {
        return semester;
    }

    public void setSemester(final String semester) {
        this.semester = semester;
    }

    public String getCode() {
        return code;
    }

    public void setCode(final String code) {
        this.code = code;
    }

    @Override
    public int hashCode() {
        return segment.hashCode() + acadYear.hashCode() + semester.hashCode() + code.hashCode();
    }

    @Override
    public boolean equals(final Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }

        if (obj instanceof ParmId) {
            ParmId right = (ParmId) obj;

            return segment.equals(right.segment) && acadYear.equals(right.acadYear)
                    && semester.equals(right.semester) && code.equals(right.code);
        } else {
            return false;
        }
    }
}
